<%@ Page Title="" MasterPageFile="~/BackOffice.master" Language="C#" AutoEventWireup="true" CodeBehind="CadastroColaborador.aspx.cs" Inherits="MakeIT.SGI.ERP.Apresentacao.CadastroColaborador" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>

<asp:Content ID="cHeadHttpEquiv" ContentPlaceHolderID="headHttpEquiv" runat="server">
</asp:Content>
<asp:Content ID="cHead" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="cCadastro" ContentPlaceHolderID="cphTituloCadastro" runat="server">
    Cadastro de Colaborador (colaborador)
</asp:Content>

<asp:Content ID="cMain" ContentPlaceHolderID="cphMain" runat="server">

    <asp:UpdatePanel ID="upnColaborador" runat="server">
        <ContentTemplate>
            <asp:TabContainer ID="tabColaborador" runat="server" ActiveTabIndex="0">
                <asp:TabPanel ID="tabPesquisa" runat="server" HeaderText="Pesquisa">
                    <ContentTemplate>
                        <div style="width: 100%; background-color:#eeeeff; min-width:400px; min-height:300px;">
                            <table border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td valign="middle" style="width:24px;">
                                        <asp:ImageButton ID="ibPesquisa" runat="server" OnClick="btnPesquisa_Click" 
                                                  ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/search.png" 
                                                  ToolTip="Executa a pesquisa aplicando os filtros"/>
                                    </td>
                                    <td valign="middle" align="left">
                                        Filtros:
                                    </td>
                                    <td>
                                        <div class="FormDiv">
                                            <div class="FormLabel">Cargo:</div>
                                            <asp:DropDownList ID="ddlIdCargo" Width="76px" ForeColor="DarkBlue" 
                                                Font-Bold="True" runat="server" DataTextField="Cargo" 
                                                DataValueField="PKString" ></asp:DropDownList>
                                        </div>
                                        <div class="FormDiv">
                                            <div class="FormLabel">Departamento:</div>
                                            <asp:DropDownList ID="ddlIdDepto" Width="76px" ForeColor="DarkBlue" 
                                                Font-Bold="True" runat="server" DataTextField="Depto" 
                                                DataValueField="PKString" ></asp:DropDownList>
                                        </div>
                                        <div class="FormDiv">
                                            <div class="FormLabel">C&oacute;digo:</div>
                                            <asp:TextBox ID="txtIdColaborador" MaxLength="11" Width="76px" 
                                                onkeypress="strictNum();" onblur="validaDecimal(this.value,11,0);" 
                                                ForeColor="DarkBlue" Font-Bold="True" runat="server"></asp:TextBox>
                                            <asp:MaskedEditExtender ID="meetxtIdColaborador" runat="server" 
                                                Mask="99999999999" TargetControlID="txtIdColaborador" PromptCharacter="" 
                                                CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder="" 
                                                CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder="" 
                                                CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True" />
                                        </div>
                                        <br />
                                        <div class="FormDiv">
                                            <div class="FormLabel">Filial:</div>
                                            <asp:DropDownList ID="ddlIdFilial" ForeColor="DarkBlue" Font-Bold="True" 
                                                AutoPostBack="true" OnSelectedIndexChanged="ddlIdFilial_SelectedIndexChanged"
                                                runat="server" DataTextField="filial" DataValueField="PKString" ></asp:DropDownList>
                                        </div>
                                        <div class="FormDiv">
                                            <div class="FormLabel">Pessoa:</div>
                                            <asp:DropDownList ID="ddlIdPessoa" ForeColor="DarkBlue" 
                                                Font-Bold="True" runat="server" DataTextField="idPessoa" 
                                                DataValueField="PKString" ></asp:DropDownList>
                                        </div>
                                        <div class="FormDiv">
                                            <div class="FormLabel">Gestor:</div>
                                            <asp:DropDownList ID="ddlIdPessoaG" ForeColor="DarkBlue" 
                                                Font-Bold="True" runat="server" DataTextField="idPessoaG" 
                                                DataValueField="PKString" ></asp:DropDownList>
                                        </div>
                                        <div class="FormDiv">
                                            <div class="FormLabel">Ativo:</div>
                                            <asp:DropDownList ID="ddlAtivo" ForeColor="DarkBlue" Font-Bold="True" 
                                                runat="server" ><asp:ListItem Text="Todos" Value=" "></asp:ListItem>
                                            <asp:ListItem Text="Sim" Value="S"></asp:ListItem>
                                            <asp:ListItem Text="N&atilde;o" Value="N"></asp:ListItem>
                                            </asp:DropDownList>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                            <hr />
                            <asp:GridView ID="grvResultado" runat="server" AutoGenerateColumns="False" EmptyDataText="N&atilde;o foram encontrados registros nessa pesquisa!"
                                  CellPadding="1" ForeColor="#333333"
                                  AllowPaging="True" PageSize="50" 
                                OnPageIndexChanging="grvResultado_PageIndexChanging" 
                                EnableModelValidation="True" >
                                <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:ImageButton ID="imgbVisualizar" runat="server" OnClick="imgbVisualizar_Click"
                                                ImageUrl="~/App_Themes/Padrao/imagens/backoffice/editar.gif" CommandArgument='<%#Eval("PKString") %>'
                                                ToolTip="Abrir formulário completo" />
                                        </ItemTemplate>
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="idColaborador" HeaderText="C&oacute;digo" DataFormatString="{0:N0}"/>
                                    <asp:BoundField DataField="idPessoaVO" HeaderText="Pessoa"/>
                                </Columns>
                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                <EditRowStyle BackColor="#999999" />
                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                            </asp:GridView>
                        </div>
                    </ContentTemplate>
                </asp:TabPanel>
                <asp:TabPanel ID="tabCadastro" runat="server" HeaderText="Cadastro">
                    <ContentTemplate>
                        <asp:Panel ID="panelCad" runat="server" BackColor="#eeeeee">
                            <div style="width: 100%; min-width:400px; min-height:300px;">
                                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td>
                                            <asp:Panel ID="panelBotoes" runat="server">
                                                <asp:Button ID="btnSalvar" runat="server" Enabled="False" ValidationGroup="Salvar"
                                                    OnClick="btnSalvar_Click" Text="Salvar" UseSubmitBehavior="false"/>
                                                &nbsp;<asp:Button ID="btnCancelar" runat="server" OnClick="btnCancelar_Click" 
                                                    Text="Cancelar" UseSubmitBehavior="false"/>
                                                <asp:Button ID="btnEditar" runat="server" Enabled="False" 
                                                    OnClick="btnEditar_Click" Text="Editar" UseSubmitBehavior="false"/>
                                                &nbsp;<asp:Button ID="btnExcluir" runat="server" Enabled="False" 
                                                    OnClick="btnExcluir_Click" Text="Excluir" UseSubmitBehavior="false"/>
                                                &nbsp;<asp:Button ID="btnNovo" runat="server" 
                                                    OnClick="btnNovo_Click" Text="Novo" UseSubmitBehavior="false"/>
                                                <asp:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="btnExcluir" ConfirmText="Confirma a exclus&atilde;o de Colaborador?">
                                                </asp:ConfirmButtonExtender>
                                                <hr />
                                            </asp:Panel>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">Cargo:</div>
                                                <asp:DropDownList ID="ddlCadIdCargo" Width="76" ForeColor="DarkBlue" Font-Bold="true" runat="server" DataTextField="Cargo" 
                                                    DataValueField="PKString" ></asp:DropDownList>
                                                <asp:HyperLink ID="HyperLinkCadIdCargo" runat="server" NavigateUrl="~/CadastroCargo.aspx" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/editar.gif" Target="CadastroCargo" ToolTip="Editar cadastro" ></asp:HyperLink>
                                                <asp:ImageButton ID="ImageButtonCadIdCargo" runat="server" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/atualizar.png" ToolTip="Atualizar lista" OnClick="atualizarDdlIdCargo" />
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">Departamento:</div>
                                                <asp:DropDownList ID="ddlCadIdDepto" Width="76" ForeColor="DarkBlue" Font-Bold="true" runat="server" DataTextField="Depto" 
                                                    DataValueField="PKString" ></asp:DropDownList>
                                                <asp:HyperLink ID="HyperLinkCadIdDepto" runat="server" NavigateUrl="~/CadastroDepto.aspx" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/editar.gif" Target="CadastroDepto" ToolTip="Editar cadastro" ></asp:HyperLink>
                                                <asp:ImageButton ID="ImageButtonCadIdDepto" runat="server" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/atualizar.png" ToolTip="Atualizar lista" OnClick="atualizarDdlIdDepto" />
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">C&oacute;digo:</div>
                                                <asp:TextBox ID="txtCadIdColaborador" MaxLength="11" Width="76" onkeypress="strictNum();" onblur="validaDecimal(this.value,11,0);" ForeColor="DarkBlue" Font-Bold="true" runat="server"></asp:TextBox>
                                                <asp:MaskedEditExtender ID="meetxtCadIdColaborador" runat="server" Mask="99999999999" TargetControlID="txtCadIdColaborador" PromptCharacter="" />
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">Pessoa:</div>
                                                <asp:DropDownList ID="ddlCadIdPessoa" ForeColor="DarkBlue" Font-Bold="true" runat="server" DataTextField="Pessoa" 
                                                    DataValueField="PKString" ></asp:DropDownList>
                                                <asp:RequiredFieldValidator ControlToValidate="ddlCadIdPessoa" InitialValue="-1"
                                                   ErrorMessage="Preenchimento obrigat&oacute;rio." ID="rfvDdlCadIdPessoa" Display="None"
                                                   runat="server" ValidationGroup="Salvar" ></asp:RequiredFieldValidator>
                                                <asp:ValidatorCalloutExtender ID="vceDdlCadIdPessoa" runat="server" TargetControlID="rfvDdlCadIdPessoa"></asp:ValidatorCalloutExtender>
                                                <asp:HyperLink ID="HyperLinkCadIdPessoa" runat="server" NavigateUrl="~/CadastroPessoa.aspx" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/editar.gif" Target="CadastroPessoa" ToolTip="Editar cadastro" ></asp:HyperLink>
                                                <asp:ImageButton ID="ImageButtonCadIdPessoa" runat="server" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/atualizar.png" ToolTip="Atualizar lista" OnClick="atualizarDdlIdPessoa" />
                                            </div>

                                            <div class="FormDiv">
                                                <div class="FormLabel">Pesquisar Pessoa:</div>
                                                <asp:TextBox ID="txtCadPesquisarPessoa" MaxLength="60" Width="100" ForeColor="DarkBlue" Font-Bold="true" runat="server"></asp:TextBox>
                                                <asp:RequiredFieldValidator ControlToValidate="txtCadPesquisarPessoa"
                                                   ErrorMessage="Preenchimento obrigat&oacute;rio." ID="rfvTxtCadPesquisarPessoa" Display="None"
                                                   runat="server" ValidationGroup="Salvar" ></asp:RequiredFieldValidator>
                                                <asp:ValidatorCalloutExtender ID="vceTxtCadPesquisarPessoa" runat="server" TargetControlID="rfvTxtCadPesquisarPessoa"></asp:ValidatorCalloutExtender>
                                            </div>
                                            <div class="FormDiv">
                                                <div class="FormLabel">Pesquisar Filial:</div>
                                                <asp:DropDownList ID="ddlCadFilialPessoa" ForeColor="DarkBlue" Font-Bold="true" runat="server" 
                                                    AutoPostBack="true" onselectedindexchanged="ddlCadFilialPessoa_SelectedIndexChanged"
                                                    DataTextField="filial" DataValueField="PKString"  ></asp:DropDownList>
                                                <asp:RequiredFieldValidator ControlToValidate="ddlCadFilialPessoa" InitialValue="-1"
                                                   ErrorMessage="Preenchimento obrigat&oacute;rio." ID="rfvDddlCadFilialPessoa" Display="None"
                                                   runat="server" ValidationGroup="Salvar" ></asp:RequiredFieldValidator>
                                                <asp:ValidatorCalloutExtender ID="vceDddlCadFilialPessoa" runat="server" TargetControlID="rfvDddlCadFilialPessoa"></asp:ValidatorCalloutExtender>
                                            </div>
                                            <div class="FormDiv">
                                                <asp:ImageButton ID="btnPesquisarPessoa" runat="server" OnClick="btnPesquisarPessoa_Click"
                                                  ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/search.png" 
                                                  ToolTip="Executa a pesquisa aplicando os filtros"
                                                  Enabled="false" />
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">Gestor:</div>
                                                <asp:DropDownList ID="ddlCadIdPessoaG" ForeColor="DarkBlue" Font-Bold="true" runat="server" DataTextField="ToString()" 
                                                    DataValueField="PKString" ></asp:DropDownList>
                                                <asp:HyperLink ID="HyperLinkCadIdPessoaG" runat="server" NavigateUrl="~/CadastroPessoa.aspx" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/editar.gif" Target="CadastroPessoa" ToolTip="Editar cadastro" ></asp:HyperLink>
                                                <asp:ImageButton ID="ImageButtonCadIdPessoaG" runat="server" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/atualizar.png" ToolTip="Atualizar lista" OnClick="atualizarDdlIdPessoaG" />
                                            </div>

                                            <div class="FormDiv">
                                                <div class="FormLabel">Pesquisar Gestor:</div>
                                                <asp:TextBox ID="txtCadPesquisarGestor" MaxLength="60" Width="100" ForeColor="DarkBlue" Font-Bold="true" runat="server"></asp:TextBox>
                                            </div>
                                            <div class="FormDiv">
                                                <div class="FormLabel">Pesquisar Filial:</div>
                                                <asp:DropDownList ID="ddlCadFilialGestor" ForeColor="DarkBlue" Font-Bold="true" runat="server" 
                                                    AutoPostBack="true" onselectedindexchanged="ddlCadFilialGestor_SelectedIndexChanged"
                                                    DataTextField="filial" DataValueField="PKString"  ></asp:DropDownList>
                                            </div>
                                            <div class="FormDiv">
                                                <asp:ImageButton ID="btnPesquisarGestor" runat="server" OnClick="btnPesquisarGestor_Click"
                                                  ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/search.png" 
                                                  ToolTip="Executa a pesquisa aplicando os filtros"
                                                  Enabled="false" />
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">Ativo:</div>
                                                <asp:DropDownList ID="ddlCadAtivo" ForeColor="DarkBlue" Font-Bold="true" runat="server" > 
                                                    <asp:ListItem Text="Sim" Value="S"></asp:ListItem>
                                                    <asp:ListItem Text="N&atilde;o" Value="N"></asp:ListItem>
                                                </asp:DropDownList>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <hr />
                                            <table  border="0" cellpadding="0" cellspacing="3">
                                                <tr>
                                                    <td class="FormLabel">
                                                        Data Cadastro:
                                                    </td>
                                                    <td class="FormLabel">
                                                        Cadastrado por:
                                                    </td>
                                                    <td class="FormLabel">
                                                        Data Edi&ccedil;&atilde;o:
                                                    </td>
                                                    <td class="FormLabel">
                                                        Editado por:
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="FormControl">
                                                        <asp:Literal ID="ltDataCadastro" runat="server"></asp:Literal>
                                                    </td>
                                                    <td class="FormControl">
                                                        <asp:Literal ID="ltCadastradoPor" runat="server"></asp:Literal>
                                                    </td>
                                                    <td class="FormControl">
                                                        <asp:Literal ID="ltDataEdicao" runat="server"></asp:Literal>
                                                    </td>
                                                    <td class="FormControl">
                                                        <asp:Literal ID="ltEditadoPor" runat="server"></asp:Literal>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </asp:Panel>
                    </ContentTemplate>
                </asp:TabPanel>
            </asp:TabContainer>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
